<?php
namespace app\api\controller;

use app\api\model\MasterModel;
use think\Controller;
class Master extends Controller
{
    function masterlist() {
        $model = new MasterModel();
        $result = $model->masterlist();
        return json($result);
    }

    function masterdetail() {
        $masterid = input('get.masterid');
        $model = new MasterModel();
        $result = $model->masterdetail($masterid);
        return json($result);
    }

    function collect() {
        $userid = input('get.userid');
        $masterid = input('get.masterid');

        $model = new MasterModel();
        $result = $model->collect($userid, $masterid);
        return json($result);
    }

    function isCollect() {
        $userid = input('get.userid');
        $masterid = input('get.masterid');

        $model = new MasterModel();
        $result = $model->isCollect($userid, $masterid);
        return json($result);
    }

    function getReply() {
        $masterid = input('get.masterid');

        $model = new MasterModel();
        $result = $model->getReply( $masterid);
        return json($result);
    }

    function reply() {
        $masterid = input('get.masterid');
        $userid = input('get.userid');
        $comment = input('get.comment');

        $model = new MasterModel();
        $result = $model->reply( $userid,$masterid,$comment);
        return json($result);
    }

        function getLesson(){
            $masterid = input('get.masterid');
            $model = new MasterModel();
            $res = $model->getlesson($masterid);
            return json($res);
        }

    public function collectMasterList(){
        $userid = input('get.userid');
        $model = new MasterModel();
        $result = $model->collectMasterList($userid);
        return json($result);
    }
}